package leetcode_700;

import helpclass.TreeNode;

/**
 *@author 周杨
 *MergeTwoBinaryTrees_617 合并两颗二叉树
 *describe:遍历递归即可 AC 23%
 *2018年9月19日 上午11:40:15
 */
public class MergeTwoBinaryTrees_617 {
	 public TreeNode mergeTrees(TreeNode t1, TreeNode t2) {
	        if(t1==null)
	        	if(t2==null)
	        		return null;
	        	else {
	        		return t2;
	        	}
	        if(t2==null) {
	        	return t1;
	        }
	        t1.val+=t2.val;
	        t1.left=mergeTrees(t1.left, t2.left);
	        t1.right=mergeTrees(t1.right, t2.right);
	        return t1;
	}
}
